Change in openvpn[master]: Add building/testing with msbuild and the clang compiler
A message that is not in the archive (sent off-list or not yet received): gerrit.1726585476000.I43d84034f3e920a45731c4aab4f851a60921290d@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
to review the following change.
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Add building/testing with msbuild and the clang compiler
The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage.
This includes a few minor changes to allow clang-cl to compile the project.
---
M .github/workflows/build.yaml
M CMakeLists.txt
M CMakePresets.json
M config.h.cmake.in
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
6 files changed, 75 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/751/1
.github/workflows/build.yaml +1 -1
@@ -272,7 +272,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env:
CMakeLists.txt +2 -1
@@ -624,7 +624,8 @@ check_linker_flag(C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt"
CMakePresets.json +56 -0
125 lines not on this page · raw message
config.h.cmake.in +5 -3
@@ -442,8 +442,10 @@ # define _GNU_SOURCE 1 #endif - -#if defined(_WIN32) +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) #include <inttypes.h> typedef uint32_t in_addr_t; typedef uint16_t in_port_t;
@@ -455,7 +457,7 @@ #define SIGTERM 15 #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(RC_INVOKED) #include <BaseTsd.h> typedef SSIZE_T ssize_t; #define strncasecmp strnicmp
src/openvpnmsica/openvpnmsica.c +8 -8
@@ -300,7 +300,7 @@UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -337,7 +337,7 @@UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif UNREFERENCED_PARAMETER (hInstall);/* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
@@ -360,7 +360,7 @@UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -633,7 +633,7 @@UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -786,7 +786,7 @@ { goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)/* * warning: enumeration value ‘MSICONDITION_TRUE’ not handled in switch * warning: enumeration value ‘MSICONDITION_NONE’ not handled in switch
@@ -806,7 +806,7 @@free (szValue); goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#endif free (szValue);
@@ -962,7 +962,7 @@UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -1162,7 +1162,7 @@UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
src/openvpnmsica/openvpnmsica.h +3 -1
@@ -66,7 +66,9 @@extern "C" {#endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which does not understand the #pragma comment(linker, ...) +* is handled the same way as mingw */ +#if defined(__GNUC__) || defined(__clang__)#define DLLEXP_DECL __declspec(dllexport)#else #define DLLEXP_DECL
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
Github Actions build: https://github.com/schwabe/openvpn/actions/runs/10905768563
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 17 Sep 2024 15:07:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
to look at the new patch set (#3).
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Add building/testing with msbuild and the clang compiler
The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage.
---
M .github/workflows/build.yaml
M CMakeLists.txt
M CMakePresets.json
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
5 files changed, 67 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/751/3
.github/workflows/build.yaml +1 -1
@@ -272,7 +272,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env:
CMakeLists.txt +2 -1
@@ -624,7 +624,8 @@ check_linker_flag(C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt"
CMakePresets.json +56 -0
125 lines not on this page · raw message
src/openvpnmsica/openvpnmsica.c +6 -6
@@ -300,7 +300,7 @@UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -337,7 +337,7 @@UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif UNREFERENCED_PARAMETER (hInstall);/* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
@@ -360,7 +360,7 @@UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -633,7 +633,7 @@UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -962,7 +962,7 @@UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -1162,7 +1162,7 @@UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
src/openvpnmsica/openvpnmsica.h +2 -1
@@ -66,7 +66,8 @@extern "C" {#endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which defines __GNUC__ is not matched here */ +#if defined(__GNUC__) || defined(__clang__)#define DLLEXP_DECL __declspec(dllexport)#else #define DLLEXP_DECL
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
to look at the new patch set (#4).
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Add building/testing with msbuild and the clang compiler
The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage.
This includes a few minor changes to allow clang-cl to compile the project.
---
M .github/workflows/build.yaml
M CMakeLists.txt
M CMakePresets.json
M config.h.cmake.in
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
6 files changed, 75 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/751/4
.github/workflows/build.yaml +1 -1
@@ -272,7 +272,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env:
CMakeLists.txt +2 -1
@@ -622,7 +622,8 @@ check_linker_flag(C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt"
CMakePresets.json +56 -0
125 lines not on this page · raw message
config.h.cmake.in +5 -3
@@ -442,8 +442,10 @@ # define _GNU_SOURCE 1 #endif - -#if defined(_WIN32) +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) #include <inttypes.h> typedef uint32_t in_addr_t; typedef uint16_t in_port_t;
@@ -455,7 +457,7 @@ #define SIGTERM 15 #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(RC_INVOKED) #include <BaseTsd.h> typedef SSIZE_T ssize_t; #define strncasecmp strnicmp
src/openvpnmsica/openvpnmsica.c +8 -8
@@ -300,7 +300,7 @@UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -337,7 +337,7 @@UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif UNREFERENCED_PARAMETER (hInstall);/* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
@@ -360,7 +360,7 @@UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -633,7 +633,7 @@UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -786,7 +786,7 @@ { goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)/* * warning: enumeration value ‘MSICONDITION_TRUE’ not handled in switch * warning: enumeration value ‘MSICONDITION_NONE’ not handled in switch
@@ -806,7 +806,7 @@free (szValue); goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#endif free (szValue);
@@ -962,7 +962,7 @@UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -1162,7 +1162,7 @@UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__)#pragma comment(linker, DLLEXP_EXPORT)#endif
src/openvpnmsica/openvpnmsica.h +3 -1
@@ -66,7 +66,9 @@extern "C" {#endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which does not understand the #pragma comment(linker, ...) +* is handled the same way as mingw */ +#if defined(__GNUC__) || defined(__clang__)#define DLLEXP_DECL __declspec(dllexport)#else #define DLLEXP_DECL
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 4:
(1 comment)
Patchset:
PS4:
Patch 4 is the same patch 2 since I accidentally pushed the wrong branch to gerrit.
GHA build for Patch 4 is https://github.com/schwabe/openvpn/actions/runs/10906577340
I had to have a different commitish since gerrit would otherwise not allow the old version to be pushed again.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 17 Sep 2024 15:50:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 4: Code-Review-1
(2 comments)
File CMakePresets.json:
http://gerrit.openvpn.net/c/openvpn/+/751/comment/5870527b_92367fa6 :
PS4, Line 145: arm64
Why no support for ARM64?
File src/openvpnmsica/openvpnmsica.h:
http://gerrit.openvpn.net/c/openvpn/+/751/comment/ca83f549_dbf9a388 :
PS4, Line 69: /* Ensure that clang-cl, which does not understand the #pragma comment(linker, ...)
That comment seems more suited to the changes to openvpnmsica.c? Maybe instead of "#pragma comment" just write "cl-specific pragmas"?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 18 Sep 2024 10:40:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 4:
(2 comments)
File CMakePresets.json:
http://gerrit.openvpn.net/c/openvpn/+/751/comment/b0c7528e_5a22270e :
PS4, Line 145: arm64
Quoted 1 line
Why no support for ARM64?
iirc when I did try for OpenVPN3, arm64 support was not included with clang toolset in msvc, will check again. But it seems that it is not supported:
error: in triplet arm64-windows-ovpn: Unable to find a valid toolchain for requested target architecture arm64. The selected Visual Studio instance is at: C:\Program Files\Microsoft Visual Studio\2022\Community The available toolchain combinations are: x86, amd64, x86_amd64, amd64_x86
File src/openvpnmsica/openvpnmsica.h:
http://gerrit.openvpn.net/c/openvpn/+/751/comment/f8f306e1_5157f7ed :
PS4, Line 69: /* Ensure that clang-cl, which does not understand the #pragma comment(linker, ...)
Quoted 1 line
That comment seems more suited to the changes to openvpnmsica. […]
yeah will reword that.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 18 Sep 2024 11:32:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Add building/testing with msbuild and the clang compiler
The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage.
This includes a few minor changes to allow clang-cl to compile the project.
---
M .github/workflows/build.yaml
M CMakeLists.txt
M CMakePresets.json
M config.h.cmake.in
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
6 files changed, 77 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/751/5
.github/workflows/build.yaml +1 -1
@@ -272,7 +272,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env:
CMakeLists.txt +2 -1
@@ -622,7 +622,8 @@ check_linker_flag(C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt"
CMakePresets.json +56 -0
125 lines not on this page · raw message
config.h.cmake.in +5 -3
@@ -442,8 +442,10 @@ # define _GNU_SOURCE 1 #endif - -#if defined(_WIN32) +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) #include <inttypes.h> typedef uint32_t in_addr_t; typedef uint16_t in_port_t;
@@ -455,7 +457,7 @@ #define SIGTERM 15 #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(RC_INVOKED) #include <BaseTsd.h> typedef SSIZE_T ssize_t; #define strncasecmp strnicmp
src/openvpnmsica/openvpnmsica.c +8 -8
@@ -300,7 +300,7 @@UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -337,7 +337,7 @@UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif UNREFERENCED_PARAMETER (hInstall);/* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
@@ -360,7 +360,7 @@UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -633,7 +633,7 @@UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -786,7 +786,7 @@ { goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)/* * warning: enumeration value ‘MSICONDITION_TRUE’ not handled in switch * warning: enumeration value ‘MSICONDITION_NONE’ not handled in switch
@@ -806,7 +806,7 @@free (szValue); goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#endif free (szValue);
@@ -962,7 +962,7 @@UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -1162,7 +1162,7 @@UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
src/openvpnmsica/openvpnmsica.h +5 -1
@@ -66,7 +66,11 @@extern "C" {#endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which does not understand the cl specific +* preprocessor defines like #pragma comment(linker, DLLEXP_EXPORT) +* is handled the same way as mingw and uses the alternative instead +* and does not define DLLEXP_EXPORT */ +#if defined(__GNUC__) || defined(__clang__)#define DLLEXP_DECL __declspec(dllexport)#else #define DLLEXP_DECL
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 4:
(2 comments)
File CMakePresets.json:
http://gerrit.openvpn.net/c/openvpn/+/751/comment/c13de973_ed7c5179 :
PS4, Line 145: arm64
Quoted 1 line
iirc when I did try for OpenVPN3, arm64 support was not included with clang toolset in msvc, will ch […]
Done
File src/openvpnmsica/openvpnmsica.h:
http://gerrit.openvpn.net/c/openvpn/+/751/comment/8fcf0cca_12d5645b :
PS4, Line 69: /* Ensure that clang-cl, which does not understand the #pragma comment(linker, ...)
Quoted 1 line
yeah will reword that.
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 18 Sep 2024 11:37:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 5:
(1 comment)
Patchset:
PS5:
C:\Users\lev\Projects\openvpn-build\src\openvpn\tests\unit_tests\openvpn\test_buffer.c(408,11): error : 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 16 [-Werror,-Wformat-truncation] [C:\Users\lev\Projects\openvpn-build\src\openvpn\out\build\win-amd64-clang-debug\test_buffer.vcxproj]
c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin>clang-cl.exe --version clang version 18.1.8
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 26 Dec 2024 11:01:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 5:
(1 comment)
Patchset:
PS5:
Well, that code block is testing correctness of snprintf(), which it can only do by intentionally overflowing and checking the results. We try to tell that to the compiler, but it seems clang 18.1 needs more help
```
/* Instead of trying to trick the compiler here, disable the warnings
* for this unit test. We know that the results will be truncated
* and we want to test that */
#if defined(__GNUC__)
/* some clang version do not understand -Wformat-truncation, so ignore the
* warning to avoid warnings/errors (-Werror) about unknown pragma/option */
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation"
#endif
```--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 26 Dec 2024 11:45:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, plaisthos.
stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 5:
(1 comment)
Patchset:
PS5:
Quoted 1 line
Well, that code block is testing correctness of
snprintf(), which it can only do by intentionally […]
This works:
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-warning-option" #pragma clang diagnostic ignored "-Wformat-truncation" #endif
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-truncation" #endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 26 Dec 2024 15:21:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
to look at the new patch set (#6).
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Add building/testing with msbuild and the clang compiler
The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage.
This includes a few minor changes to allow clang-cl to compile the project.
---
M .github/workflows/build.yaml
M CMakeLists.txt
M CMakePresets.json
M config.h.cmake.in
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
M tests/unit_tests/openvpn/test_buffer.c
7 files changed, 81 insertions(+), 17 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/751/6
.github/workflows/build.yaml +1 -1
@@ -259,7 +259,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env:
CMakeLists.txt +2 -1
@@ -627,7 +627,8 @@ check_linker_flag(C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt"
CMakePresets.json +56 -0
125 lines not on this page · raw message
config.h.cmake.in +5 -3
@@ -439,8 +439,10 @@ # define _GNU_SOURCE 1 #endif - -#if defined(_WIN32) +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) #include <inttypes.h> typedef uint32_t in_addr_t; typedef uint16_t in_port_t;
@@ -452,7 +454,7 @@ #define SIGTERM 15 #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(RC_INVOKED) #include <BaseTsd.h> typedef SSIZE_T ssize_t; #define strncasecmp strnicmp
src/openvpnmsica/openvpnmsica.c +8 -8
@@ -303,7 +303,7 @@UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -340,7 +340,7 @@UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif UNREFERENCED_PARAMETER (hInstall);/* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
@@ -363,7 +363,7 @@UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -636,7 +636,7 @@UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -789,7 +789,7 @@ { goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)/* * warning: enumeration value ‘MSICONDITION_TRUE’ not handled in switch * warning: enumeration value ‘MSICONDITION_NONE’ not handled in switch
@@ -809,7 +809,7 @@free (szValue); goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#endif free (szValue);
@@ -965,7 +965,7 @@UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -1165,7 +1165,7 @@UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
src/openvpnmsica/openvpnmsica.h +5 -1
@@ -66,7 +66,11 @@extern "C" {#endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which does not understand the cl specific +* preprocessor defines like #pragma comment(linker, DLLEXP_EXPORT) +* is handled the same way as mingw and uses the alternative instead +* and does not define DLLEXP_EXPORT */ +#if defined(__GNUC__) || defined(__clang__)#define DLLEXP_DECL __declspec(dllexport)#else #define DLLEXP_DECL
tests/unit_tests/openvpn/test_buffer.c +4 -3
@@ -389,8 +389,9 @@/* Instead of trying to trick the compiler here, disable the warnings * for this unit test. We know that the results will be truncated -* and we want to test that */ -#if defined(__GNUC__) +* and we want to test that. Not we need the clang as clang-cl (msvc) does +* not define __GNUC__ like it does under UNIX(-like) platforms */ +#if defined(__GNUC__) || defined(__clang__)/* some clang version do not understand -Wformat-truncation, so ignore the * warning to avoid warnings/errors (-Werror) about unknown pragma/option */ #if defined(__clang__)
@@ -418,7 +419,7 @@assert_int_equal (ret,10 );assert_int_equal (buf[9 ],'\0' ); -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#if defined(__clang__)#pragma clang diagnostic pop
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, stipa.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 6:
(1 comment)
Patchset:
PS5:
Quoted 1 line
This works: […]
Yes but that also adds the option twice for clang, which doesn't hurt. I changed the first line to be __GUNUC__ || __clang__ instead.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Fri, 27 Dec 2024 01:21:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, plaisthos.
stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Patch Set 6: Code-Review+2
(1 comment)
Patchset:
PS6:
Stared at the code and built with MSVC and clang-cl and cl.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 27 Dec 2024 11:14:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v6 1/1 Add building/testing with msbuild and the clang compiler
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage.
This includes a few minor changes to allow clang-cl to compile the project.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/751
This mail reflects revision 6 of this Change.
Acked-by according to Gerrit (reflected above):
Lev Stipakov <[email protected]...>
.github/workflows/build.yaml +1 -1
@@ -259,7 +259,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env:
CMakeLists.txt +2 -1
@@ -627,7 +627,8 @@ check_linker_flag(C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt"
CMakePresets.json +56 -0
125 lines not on this page · raw message
config.h.cmake.in +5 -3
@@ -439,8 +439,10 @@ # define _GNU_SOURCE 1 #endif - -#if defined(_WIN32) +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) #include <inttypes.h> typedef uint32_t in_addr_t; typedef uint16_t in_port_t;
@@ -452,7 +454,7 @@ #define SIGTERM 15 #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(RC_INVOKED) #include <BaseTsd.h> typedef SSIZE_T ssize_t; #define strncasecmp strnicmp
src/openvpnmsica/openvpnmsica.c +8 -8
@@ -303,7 +303,7 @@UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -340,7 +340,7 @@UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif UNREFERENCED_PARAMETER (hInstall);/* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
@@ -363,7 +363,7 @@UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -636,7 +636,7 @@UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -789,7 +789,7 @@ { goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)/* * warning: enumeration value ‘MSICONDITION_TRUE’ not handled in switch * warning: enumeration value ‘MSICONDITION_NONE’ not handled in switch
@@ -809,7 +809,7 @@free (szValue); goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#endif free (szValue);
@@ -965,7 +965,7 @@UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -1165,7 +1165,7 @@UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
src/openvpnmsica/openvpnmsica.h +5 -1
@@ -66,7 +66,11 @@extern "C" {#endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which does not understand the cl specific +* preprocessor defines like #pragma comment(linker, DLLEXP_EXPORT) +* is handled the same way as mingw and uses the alternative instead +* and does not define DLLEXP_EXPORT */ +#if defined(__GNUC__) || defined(__clang__)#define DLLEXP_DECL __declspec(dllexport)#else #define DLLEXP_DECL
tests/unit_tests/openvpn/test_buffer.c +4 -3
@@ -389,8 +389,9 @@/* Instead of trying to trick the compiler here, disable the warnings * for this unit test. We know that the results will be truncated -* and we want to test that */ -#if defined(__GNUC__) +* and we want to test that. Not we need the clang as clang-cl (msvc) does +* not define __GNUC__ like it does under UNIX(-like) platforms */ +#if defined(__GNUC__) || defined(__clang__)/* some clang version do not understand -Wformat-truncation, so ignore the * warning to avoid warnings/errors (-Werror) about unknown pragma/option */ #if defined(__clang__)
@@ -418,7 +419,7 @@assert_int_equal (ret,10 );assert_int_equal (buf[9 ],'\0' ); -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#if defined(__clang__)#pragma clang diagnostic pop
[Openvpn-devel] [PATCH applied] Re: Add building/testing with msbuild and the clang compiler
Sanity tested on my GH account. Succeeds.
Your patch has been applied to the master branch.
commit c815217ab6f7f203f82e9d26771f4f461242bfd2
Author: Arne Schwabe Date: Fri Dec 27 12:22:07 2024 +0100
Add building/testing with msbuild and the clang compiler
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Lev Stipakov <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30231.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#7) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by stipa
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Add building/testing with msbuild and the clang compiler
The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage.
This includes a few minor changes to allow clang-cl to compile the project.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30231.html
---
M .github/workflows/build.yaml
M CMakeLists.txt
M CMakePresets.json
M config.h.cmake.in
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
M tests/unit_tests/openvpn/test_buffer.c
7 files changed, 81 insertions(+), 17 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/751/7
.github/workflows/build.yaml +1 -1
@@ -259,7 +259,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env:
CMakeLists.txt +2 -1
@@ -627,7 +627,8 @@ check_linker_flag(C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt"
CMakePresets.json +56 -0
125 lines not on this page · raw message
config.h.cmake.in +5 -3
@@ -439,8 +439,10 @@ # define _GNU_SOURCE 1 #endif - -#if defined(_WIN32) +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) #include <inttypes.h> typedef uint32_t in_addr_t; typedef uint16_t in_port_t;
@@ -452,7 +454,7 @@ #define SIGTERM 15 #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(RC_INVOKED) #include <BaseTsd.h> typedef SSIZE_T ssize_t; #define strncasecmp strnicmp
src/openvpnmsica/openvpnmsica.c +8 -8
@@ -303,7 +303,7 @@UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -340,7 +340,7 @@UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif UNREFERENCED_PARAMETER (hInstall);/* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
@@ -363,7 +363,7 @@UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -636,7 +636,7 @@UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -789,7 +789,7 @@ { goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)/* * warning: enumeration value ‘MSICONDITION_TRUE’ not handled in switch * warning: enumeration value ‘MSICONDITION_NONE’ not handled in switch
@@ -809,7 +809,7 @@free (szValue); goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#endif free (szValue);
@@ -965,7 +965,7 @@UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -1165,7 +1165,7 @@UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
src/openvpnmsica/openvpnmsica.h +5 -1
@@ -66,7 +66,11 @@extern "C" {#endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which does not understand the cl specific +* preprocessor defines like #pragma comment(linker, DLLEXP_EXPORT) +* is handled the same way as mingw and uses the alternative instead +* and does not define DLLEXP_EXPORT */ +#if defined(__GNUC__) || defined(__clang__)#define DLLEXP_DECL __declspec(dllexport)#else #define DLLEXP_DECL
tests/unit_tests/openvpn/test_buffer.c +4 -3
@@ -389,8 +389,9 @@/* Instead of trying to trick the compiler here, disable the warnings * for this unit test. We know that the results will be truncated -* and we want to test that */ -#if defined(__GNUC__) +* and we want to test that. Not we need the clang as clang-cl (msvc) does +* not define __GNUC__ like it does under UNIX(-like) platforms */ +#if defined(__GNUC__) || defined(__clang__)/* some clang version do not understand -Wformat-truncation, so ignore the * warning to avoid warnings/errors (-Werror) about unknown pragma/option */ #if defined(__clang__)
@@ -418,7 +419,7 @@assert_int_equal (ret,10 );assert_int_equal (buf[9 ],'\0' ); -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#if defined(__clang__)#pragma clang diagnostic pop
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 7
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=email )
Change subject: Add building/testing with msbuild and the clang compiler
......................................................................
Add building/testing with msbuild and the clang compiler
The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage.
This includes a few minor changes to allow clang-cl to compile the project.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30231.html
---
M .github/workflows/build.yaml
M CMakeLists.txt
M CMakePresets.json
M config.h.cmake.in
M src/openvpnmsica/openvpnmsica.c
M src/openvpnmsica/openvpnmsica.h
M tests/unit_tests/openvpn/test_buffer.c
7 files changed, 81 insertions(+), 17 deletions(-)
.github/workflows/build.yaml +1 -1
@@ -259,7 +259,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env:
CMakeLists.txt +2 -1
@@ -627,7 +627,8 @@ check_linker_flag(C -Wl,--wrap=parse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt"
CMakePresets.json +56 -0
125 lines not on this page · raw message
config.h.cmake.in +5 -3
@@ -439,8 +439,10 @@ # define _GNU_SOURCE 1 #endif - -#if defined(_WIN32) +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) #include <inttypes.h> typedef uint32_t in_addr_t; typedef uint16_t in_port_t;
@@ -452,7 +454,7 @@ #define SIGTERM 15 #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(RC_INVOKED) #include <BaseTsd.h> typedef SSIZE_T ssize_t; #define strncasecmp strnicmp
src/openvpnmsica/openvpnmsica.c +8 -8
@@ -303,7 +303,7 @@UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -340,7 +340,7 @@UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif UNREFERENCED_PARAMETER (hInstall);/* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
@@ -363,7 +363,7 @@UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -636,7 +636,7 @@UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -789,7 +789,7 @@ { goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)/* * warning: enumeration value ‘MSICONDITION_TRUE’ not handled in switch * warning: enumeration value ‘MSICONDITION_NONE’ not handled in switch
@@ -809,7 +809,7 @@free (szValue); goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#endif free (szValue);
@@ -965,7 +965,7 @@UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
@@ -1165,7 +1165,7 @@UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)#endif
src/openvpnmsica/openvpnmsica.h +5 -1
@@ -66,7 +66,11 @@extern "C" {#endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which does not understand the cl specific +* preprocessor defines like #pragma comment(linker, DLLEXP_EXPORT) +* is handled the same way as mingw and uses the alternative instead +* and does not define DLLEXP_EXPORT */ +#if defined(__GNUC__) || defined(__clang__)#define DLLEXP_DECL __declspec(dllexport)#else #define DLLEXP_DECL
tests/unit_tests/openvpn/test_buffer.c +4 -3
@@ -389,8 +389,9 @@/* Instead of trying to trick the compiler here, disable the warnings * for this unit test. We know that the results will be truncated -* and we want to test that */ -#if defined(__GNUC__) +* and we want to test that. Not we need the clang as clang-cl (msvc) does +* not define __GNUC__ like it does under UNIX(-like) platforms */ +#if defined(__GNUC__) || defined(__clang__)/* some clang version do not understand -Wformat-truncation, so ignore the * warning to avoid warnings/errors (-Werror) about unknown pragma/option */ #if defined(__clang__)
@@ -418,7 +419,7 @@assert_int_equal (ret,10 );assert_int_equal (buf[9 ],'\0' ); -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__)#pragma GCC diagnostic pop#if defined(__clang__)#pragma clang diagnostic pop
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 7
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged